package app;

import data.config.DataBaseConfiguration;
import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.Import;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import securityconfig.SecurityConfiguration;

/**
 * Created by Administrator on 2016/11/3.
 */
@EnableZuulProxy
@EnableResourceServer
@EnableOAuth2Sso
@SpringCloudApplication
@Import(value = {DataBaseConfiguration.class, SecurityConfiguration.class})
public class ZuulApplication {
    public static void main(String[] args) {
        new SpringApplicationBuilder(ZuulApplication.class).web(true).run(args);

    }


//    @Bean
//    public SampleZuulFilter SampleZuulFilter() {
//        return new SampleZuulFilter();
//    }
//
//    @Autowired
//    private UserRepository userRepository;
//    @Autowired
//    private HttpServletRequest request;
//
//    @RequestMapping(value = "/logintest", method = RequestMethod.POST)
//    @ResponseBody
//    public UserEntity findUser(@RequestParam String userName, @RequestParam String password) {
//        UserEntity user = userRepository.findByName(userName);
//        if(user.getPassword().equals(password)){
//            request.getSession().setAttribute("user",user);
//        }
//        return user;
//    }
}
